<?php

class LoginController extends ControllerBackend
{
    public $defaultAction = 'index';
    
    public function actionIndex()
    {
        $model = new LoginForm;
        
		if (isset($_POST['LoginForm']))
		{
			$model->attributes = $_POST['LoginForm'];
            $model->admin = true;
			if ($model->validate() && $model->login()) {
                $this->redirect(array('//dashboard/default'));
			}				
		}

		$this->layout = '//layouts/login';        
        $this->render('/login/login',array('model'=>$model));
    }
}